package com.geo.geotool.base.entity;


import com.geo.geotool.base.enmu.RetCode;

/**
 * • @Description: TODO
 * • @author  : yell
 * • @date : 2021/10/27 17:09
 */
public class RetResponse {

    private final static String SUCCESS = "SUCCESS";

    public static <T> RetEntity<T> makeOKRsp() {
        return new RetEntity<T>().setCode(RetCode.SUCCESS).setMsg(SUCCESS);
    }

    public static <T> RetEntity<T> makeOKRsp(T data) {
        return new RetEntity<T>().setCode(RetCode.SUCCESS).setMsg(SUCCESS).setSuccess(true).setData(data);
    }

    public static <T> RetEntity<T> makeErrRsp(String message) {
        return new RetEntity<T>().setCode(RetCode.FAIL).setSuccess(false).setMsg(SUCCESS);
    }

    public static <T> RetEntity<T> makeRsp(int code, String msg) {
        return new RetEntity<T>().setCode(code).setMsg(msg);
    }

    public static <T> RetEntity<T> makeRsp(int code, String msg, T data) {
        return new RetEntity<T>().setCode(code).setMsg(msg).setData(data);
    }
}
